package com.labot.authentication.ldap.dto;


/**
 * 
 * @author Enrique Barbeito
 *
 */
public class DtoUsuarioExchange {
	
	private Long id;	
	private String username;
	private String name;
	private String email;
	private String department;
	private String telephone;
	private byte[] photo = null;
	
	public DtoUsuarioExchange() {
		
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String userName) {
		this.username = userName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String mail) {
		this.email = mail;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	
	public byte[] getPhoto() {
		return photo;
	}

	public void setPhoto(byte[] photo) {
		this.photo = photo;
	}
	
	private Boolean hasPhoto() {
		if (photo != null) {
			return true;
		}
		return false;
	}

	@Override
	public String toString() {
		return "--------------------------------------------------------------------------------------\n" +
			   " NOMBRE DE USUARIO: " + username + "\n" +
			   " NOMBRE           : " + name + "\n" +
			   " MAIL             : " + email + "\n" +
			   " DEPARTAMENTO     : " + department + "\n" +
			   " PHOTO            : " + hasPhoto() + "\n" + 
			   "--------------------------------------------------------------------------------------\n";
	}

	
	@Override
    public boolean equals(Object o) {
        if (this == o)
            return true;

        if (!( o instanceof DtoUsuarioExchange))
            return false;

        final DtoUsuarioExchange keyed = (DtoUsuarioExchange) o;
        
        if(username == null)
        	return false;
        
        if(keyed.getUsername() == null)
        	return false;

        if(username.equals(keyed.getUsername())){
            return true;
        }

        return false;
    }
	
}
